"use strict";

var lat = localStorage.getItem("lat"),
    lng = localStorage.getItem("lng"),
    area_id = localStorage.getItem("qf_city_id"),
    cat_id = getParams("cat_id"),
    attr = getParams("attr") || "",
    pageno = getParams("pageno") || 1,
    order = getParams("order") || "";function filterJump(_ref) {
  var t = _ref.cat_id,
      a = _ref.pageno,
      e = _ref.order,
      i = _ref.attr;
  var l = "./waimai.html";if (l = (l += "?cat_id=" + (t || cat_id)) + ("&pageno=" + (a || pageno)), (order || e) && (l += "&order=" + (e || order)), i) {
    var _a = i.split(":"),
        _t = attr.split(",").filter(function (t) {
      if (t) return !t.includes(_a[0]);
    });"remove" != _a[1] && _t.push(i), l += "&attr=" + _t.join(",");
  }return l;
}cat_id || (location.href = "./404.html"), $(".tags a").each(function (t, a) {
  $(a).attr("href", filterJump({ order: ["comment", "sell", "location"][t] }));
}), $.get("http://kg.zhaodashen.cn/mt/web/waimai/cate.jsp", { cat_id: cat_id }, function (t) {
  $(".filter .condition").text(""), $.each(t.data, function (t, e) {
    var i = "",
        a = ($.each(e.attr_value.split(","), function (t, a) {
      "分类" === e.attr_name ? (t = e.attr_id.split(",")[t], i += "<li>\n          <a \n            id=\"" + t + "\" \n            href=\"" + filterJump({ cat_id: t }) + "\"\n          >\n          " + a + "\n          </a>\n          </li>") : i += "<li> \n          <a href=\"" + filterJump({ attr: e.attr_name + ":" + a }) + "\">" + a + "</a> \n        </li>";
    }), "");a = "分类" == e.attr_name ? "<div class=\"all on\" onclick=\"location.href='" + filterJump({ cat_id: 2 }) + "'\">\u5168\u90E8</div>" : "<div class=\"all on\" onclick=\"location.href='" + filterJump({ attr: e.attr_name + ":remove" }) + "'\">\u5168\u90E8</div>";var l = "<div class=\"cont clear\">\n          <div class=\"classification\">" + e.attr_name + "</div>\n          " + a + "\n          <ul class=\"more clear\">\n          " + i + "\n          </ul>\n      </div>";$(".filter .condition").append(l);
  }), $(".condition .cont:eq(0) .all").removeClass("on");var a = $(".condition .cont:eq(0) ul li").find("a[id=\"" + cat_id + "\"]");(a.length ? a : $(".condition .cont:eq(0) .all")).addClass("on");t = attr.split(","), $.each(t, function (t, a) {
    a = a.split(":");var e = $(".condition .cont .classification:contains(" + a[0] + ")").parents(".cont"),
        i = (e.find(".on").removeClass("on"), e.find("a:contains(" + a[1] + ")"));(i && 1 <= i.length ? i : e.parents(".all")).addClass("on");
  }), $(".tags span a").css("color", "#222"), t = ["comment", "sell", "location"].indexOf(order);-1 !== t && $(".tags span a:eq(" + t + ")").css("color", "rgb(19, 209, 190)");
}, "json");